import 'package:flutter/material.dart';
import 'dart:io';
import 'package:path_provider/path_provider.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: "Local Image Demo",
      theme: ThemeData.fallback(),
      home: FutureBuilder(
        builder: (BuildContext context, AsyncSnapshot<File> snapshot) {
//          print(snapshot.data);
//          print('=== file exists: ${snapshot.data.existsSync()} ===');
          return snapshot.data != null
            ? Image.file(snapshot.data)
            : Container();
        },
        future: _getLocalFile('Download/slider2.png')
      ),
    );
  }

  Future<File> _getLocalFile(String filename) async {
    Directory dir = await getExternalStorageDirectory();
    String path = dir.path;
    return File('$path/$filename');
  }
}
